package com.example.thread.d6_1悲观锁乐观锁;

import java.util.concurrent.atomic.AtomicInteger;

public class MyRunnable implements Runnable{
//    private int count;
    private AtomicInteger count = new AtomicInteger();
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            // 方式一
//            synchronized (this) {
//                System.out.println("count===>"+(++count));
//            }
            System.out.println("count======>"+count.incrementAndGet());
        }
    }
}
